const KoaRouter = require("@koa/router");
const userController = require('../controller/userController.js')
const {verifyUser, hanlPassword} = require('../middleware/userMiddleware.js')

// 创建路由对象
const userRouter = new KoaRouter({ prefix: "/users" });

// 编写接口  verifyUser 验证用户的中间件 加密密码   通过后操作数据库
userRouter.post("/register", verifyUser , hanlPassword, userController.create);

// 查看用户头像
userRouter.get("/avatar/:userId" , userController.showAvatar)

module.exports = userRouter;
